import uuid
from datetime import datetime

from sqlalchemy import Column, BigInteger, String, Boolean, DateTime, text, Text, JSON

from core.database import Base


class Template(Base):
    __tablename__ = "template"
    id= Column(BigInteger, primary_key=True,autoincrement=True,comment='主键ID')
    template_id= Column(String(36),nullable=False,unique=True,default=lambda: str(uuid.uuid4()),comment='模板ID')
    name= Column(String(100),nullable=False,comment='模板名称')
    description = Column(Text,nullable=True,comment='模板描述')
    is_default= Column(Boolean(False),nullable=False,comment='是否默认')
    created_at = Column(DateTime, default=datetime.now, server_default=text('CURRENT_TIMESTAMP'), comment='创建时间')
    configs = Column(JSON,nullable=True,comment='模板配置')
    user_id = Column(String(36),nullable=False,comment='用户ID')





